{extend name="config/base"/}
{block name="body"}

<div id="center">
<div id="center_base"><div>

<div id="center_account">
    <div class="row">
        <div class="col-xs-12">
            <ul class="nav nav-secondary">
                <li class="active">
                    <a href="#base" data-toggle="tab">
                        {:lang('_DATA_BASIC_')}
                    </a>
                </li>
                {volist name="profile_group_list" id="vl"}
                    <li>
                        <a href="#expand_tab_{$vl.id}" data-toggle="tab">{$vl.profile_name}</a>
                    </li>
                {/volist}
            </ul>

        </div>
    </div>
    <div class="tab-content">
        <div class="tab-pane active" id="base">
            <div class="with-padding" style="padding: 20px">
                <div class="row">
                    <div class="col-xs-8 center_info form-horizontal">
                        {php}if(check_reg_type('username')){{/php}
                        <div class="form-group">
                            <label for="aUsername" class="col-xs-2 control-label">{:lang('_USERNAME_')}</label>

                            <div class="col-xs-10">
                                {php}if($accountInfo['username']){{/php}
                                    <span class="lh32">{$accountInfo['username']}</span>
                                {php}}else{{/php}
                                    <input type="text" class="form-control pull-left" id="aUsername" value=""
                                       placeholder="{:lang('_USER_NAME_NOT_SET_')}{:lang('_WAVE_')}">
                                    <a class="pull-left lh32 saveUsername" style="margin-left: 10px">{:lang('_SETTINGS_')}</a>

                                {php}}{/php}
                            </div>
                        </div>

                        {php}}{/php}

                        {php}if(check_reg_type('email')){{/php}
                        <div class="form-group">
                            <label for="aEmail" class="col-xs-2 control-label">{:lang('_EMAIL_')}</label>

                            <div class="col-xs-10">

                                {$accountInfo.email|default=lang('_SET_NOT_')}
                                <a class=" lh32"
                                   data-remote="{:Url('ucenter/config/changeaccount',array('tag'=>'email'))}"
                                   data-toggle="modal">{:lang('_EMAIL_MODIFY_')}</a>
                            </div>
                        </div>
                        {php}}{/php}

                        {php}if(check_reg_type('mobile')){{/php}

                        <div class="form-group">
                            <label for="aMobile" class="col-xs-2 control-label">{:lang('_PHONE_')}</label>

                            <div class="col-xs-10">
                                {$accountInfo.mobile|default=lang('_SET_NOT_')}

                                <a class=" lh32 " style="margin-left: 10px"
                                   data-remote="{:Url('ucenter/config/changeaccount',array('tag'=>'mobile'))}"
                                   data-toggle="modal">{:lang('_PHONE_MODIFY_')}</a>
                            </div>
                        </div>
                        {php}}{/php}
                    </div>
                </div>
                <div class="row">
                    <div class="col-xs-8">
                        <form class="form-horizontal center_info ajax-form" role="form"
                              action="{:Url('ucenter/Config/index')}" method="post">
                            <div class="form-group">
                                <label for="nickname" class="col-xs-2 control-label">{:lang('_NICKNAME_')}</label>

                                <div class="col-xs-10">
                                    <input type="text" class="form-control" id="nickname" name="nickname"
                                           value="{$user.nickname|text}"
                                           placeholder="{:lang('_NICKNAME_')}">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-xs-2 control-label">{:lang('_SEX_')}</label>

                                <div class="col-xs-10">
                                    <label class="radio-inline">
                                        <input name="sex" type="radio" value="1"
                                        {eq name="user.sex" value="1"} checked{/eq}
                                       >{:lang('_MAN_')}
                                    </label>
                                    <label class="radio-inline">
                                        <input name="sex" type="radio" value="2"
                                        {eq name="user.sex" value="2"} checked{/eq}
                                       >{:lang('_WOMAN_')}
                                    </label>
                                    <label class="radio-inline">
                                        <input name="sex" type="radio" value="0"
                                        {eq name="user.sex" value="0"} checked{/eq}
                                       >{:lang('_SECRECY_')}
                                    </label>
                                </div>
                            </div>
                            <div class="form-group position">
                                <label for="email" class="col-xs-2 control-label">{:lang('_PLACE_')}</label>

                                <div class="col-xs-10">
                                    {:hook('Chinacity',['province'=>$user['pos_province'],'city'=>$user['pos_city'],'district'=>$user['pos_district'],'community'=>$user['pos_community']])}
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="signature" class="col-xs-2 control-label">{:lang('_SIGNATURE_')}</label>

                                <div class="col-xs-10">
                                    <textarea id="signature" name="signature" class="form-control"
                                              style="width: 100%; height: 6em;resize: none">{$user.signature|htmlspecialchars}</textarea>
                                </div>
                            </div>

                            <div class="form-group">
                                <div class="col-sm-offset-2 col-xs-10">
                                    <button type="submit" class="btn btn-primary">{:lang('_SAVE_')}</button>
                                </div>
                            </div>
                        </form>
                    </div>

                </div>

            </div>
        </div>

            {volist name="profile_group_list" id="vo"}
                <div class="tab-pane" id="expand_tab_{$vo.id}">
                    <form action="{:Url('Config/edit_expandinfo')}" method="post" class="ajax-form">
                    <div class="with-padding">
                        <div class="row">
                            <div class="col-xs-8">
                                <input type="hidden" name="profile_group_id" value="{$vo.id}">
                                <div>
                                    <volist name="vo.fields" id="vl">
                                        <dl>
                                            {:widget('inputRender/inputRender',array($vl,'personal'))}
                                        </dl>
                                    </volist>
                                </div>
                                {if condition="count($vo['fields']) neq 0"}
                                    <input type="submit" value="{:lang('_SAVE_')}" id="submit_btn"
                                           class="btn btn-primary expandinfo-sumbit">
                                {else/}
                                    <span class="expandinfo-noticeinfo">{:lang('_MESSAGE_EXPAND_NONE_')}{:lang('_EXCLAMATION_')}</span>
                                {/if}
                            </div>
                        </div>
                    </div>
                </form>
                </div>
            {/volist}
    </div>
</div>
</div>


</div>
</div>


</div>

{/block}
{block name="script"}
<script type="text/javascript" src="__JS__/expandinfo-form.min.js"></script>
<script>
    function center_toggle(name) {
        var show = $('#' + name + '_panel').css('display');
        $('.center_panel').hide();
        $('.center_arrow_right').show();
        $('.center_arrow_bottom').hide()
        if (show == 'none') {
            $('#' + name + '_panel').show();
            $('#' + name + '_toggle_right').hide();
            $('#' + name + '_toggle_bottom').show()
        } else {
            $('#' + name + '_toggle_right').show();
            $('#' + name + '_toggle_bottom').hide()
        }
    }

    $(function () {
        $('.saveUsername').click(function () {
            var username = $(this).prev().val();
            if (!username) {
                toast.error("{:lang('_USERNAME_NOT_EMPTY_')}{:lang('_EXCLAMATION_')}");
                return false;
            }
            if (confirm("{:lang('_USERNAME_SET_ONCE_')}{:lang('_QUESTION_')}")) {
                $.post("{:Url('ucenter/config/saveUsername')}", {username: username}, function (res) {
                    handleAjax(res);
                })
            }
        })
    })
</script>
{/block}